﻿<phone:PhoneApplicationPage 
	xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
	xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
	xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
	xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
	xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
	xmlns:controls="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls"
    xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"
 	xmlns:local="clr-namespace:Nok_Air"
 	mc:Ignorable="d" d:DesignWidth="480" d:DesignHeight="800"
	x:Class="Nok_Air.SelectFlights"
	Foreground="{StaticResource PhoneForegroundBrush}"
	Orientation="Portrait" FontFamily="/Nok Air;component/Fonts/Fonts.zip#PSL Display" FontSize="40">
    
    <phone:PhoneApplicationPage.Resources>
        <local:DayConverter x:Key="DayConverter" />
        <local:GroupSellingClassEconomyConverter x:Key="GroupSellingClassEconomyConverter" />
        <local:GroupSellingClassFlexiConverter x:Key="GroupSellingClassFlexiConverter"/>
        <local:GroupSellingClassNokPlusConverter x:Key="GroupSellingClassNokPlusConverter"/>
        <local:DepartuerOrReturnSellingClass x:Key="DepartuerOrReturnSellingClass"/>
        <Style x:Key="SellingClassRadioButtonStyle" TargetType="RadioButton">
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="RadioButton">
                        <StackPanel x:Name="stackPanel" Height="125" Background="#FFFFFAD4" Margin="5,0">
                            <VisualStateManager.VisualStateGroups>
                                <VisualStateGroup x:Name="CommonStates">
                                    <VisualState x:Name="MouseOver"/>
                                    <VisualState x:Name="Pressed"/>
                                    <VisualState x:Name="Disabled">
                                    	<Storyboard>
                                    		<ColorAnimation Duration="0" To="#CCCCCC" Storyboard.TargetProperty="(Panel.Background).(SolidColorBrush.Color)" Storyboard.TargetName="stackPanel" d:IsOptimized="True"/>
                                    		<ColorAnimationUsingKeyFrames Storyboard.TargetProperty="(TextBlock.Foreground).(SolidColorBrush.Color)" Storyboard.TargetName="textBlock">
                                    			<EasingColorKeyFrame KeyTime="0" Value="#FF858585"/>
                                    		</ColorAnimationUsingKeyFrames>
                                    		<ColorAnimationUsingKeyFrames Storyboard.TargetProperty="(TextBlock.Foreground).(SolidColorBrush.Color)" Storyboard.TargetName="textBlock1">
                                    			<EasingColorKeyFrame KeyTime="0" Value="#FF707070"/>
                                    		</ColorAnimationUsingKeyFrames>
                                    	</Storyboard>
                                    </VisualState>
                                    <VisualState x:Name="Normal"/>
                                </VisualStateGroup>
                                <VisualStateGroup x:Name="CheckStates">
                                    <VisualState x:Name="Checked">
                                        <Storyboard>
                                            <ColorAnimation Duration="0:0:0.3" To="#FF3F4BFD" Storyboard.TargetProperty="(Panel.Background).(SolidColorBrush.Color)" Storyboard.TargetName="stackPanel" d:IsOptimized="True"/>
                                            <ColorAnimation Duration="0:0:0.3" To="White" Storyboard.TargetProperty="(TextBlock.Foreground).(SolidColorBrush.Color)" Storyboard.TargetName="textBlock1" d:IsOptimized="True"/>
                                        </Storyboard>
                                    </VisualState>
                                    <VisualState x:Name="Unchecked"/>
                                    <VisualState x:Name="Indeterminate"/>
                                </VisualStateGroup>
                            </VisualStateManager.VisualStateGroups>
                            <Grid Margin="0" Height="75">
                                <!--{Binding ClassName}-->
                                <TextBlock x:Name="textBlock1" Text="{Binding ClassName}" Foreground="Black" FontFamily="/Nok Air;component/Fonts/Fonts.zip#PSL Display" FontSize="42.667" HorizontalAlignment="Center" MinHeight="32" VerticalAlignment="Center"/>
                            </Grid>
                            <Grid Margin="0" Height="50" Background="{TemplateBinding Background}">
                                <!--{Binding FareValue}-->
                                <TextBlock x:Name="textBlock" Text="{Binding FareValue}" Margin="0" HorizontalAlignment="Center" VerticalAlignment="Center"  Foreground="Black" FontFamily="/Nok Air;component/Fonts/Fonts.zip#PSL Display" FontSize="32"/>
                            </Grid>
                            <ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center" Visibility="Collapsed"/>
                        </StackPanel>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
            <Setter Property="FontFamily" Value="/Nok Air;component/Fonts/Fonts.zip#PSL Display"/>
            <Setter Property="FontSize" Value="26.667"/>
            <Setter Property="Foreground" Value="Black"/>
        </Style>
        <DataTemplate x:Key="PivotItemTemplate">
            <StackPanel Margin="0,-25,0,0">
                <StackPanel Background="White">
                    <TextBlock Text="{Binding Date, Converter={StaticResource DayConverter}}" TextWrapping="Wrap" Style="{StaticResource PhoneTextExtraLargeStyle}" Foreground="#DB045B" FontFamily="/Nok Air;component/Fonts/Fonts.zip#PSL Display" FontSize="40" Margin="10,0,0,0"/>
                </StackPanel>
                <ListBox x:Name="flightsList" ItemsSource="{Binding FlightSegmentItem}" Tag="{Binding Converter={StaticResource DepartuerOrReturnSellingClass}}" Background="{x:Null}" ScrollViewer.VerticalScrollBarVisibility="Auto" Height="440" Margin="0,0,0,0">
                    <ListBox.ItemTemplate>
                        <DataTemplate>
                            <Grid VerticalAlignment="Top" Margin="0,10,0,0">
                                <StackPanel Width="460">
                                    <StackPanel Orientation="Horizontal" VerticalAlignment="Center" Margin="5,10" Background="White">
                                        <TextBlock Text="{Binding FlightNumber}" TextWrapping="Wrap" Style="{StaticResource PhoneTextExtraLargeStyle}" Foreground="Black" FontFamily="/Nok Air;component/Fonts/Fonts.zip#PSL Display" FontSize="40" HorizontalAlignment="Center" VerticalAlignment="Center"/>
                                        <TextBlock Text="Dep." Style="{StaticResource PhoneTextExtraLargeStyle}" Foreground="Black" FontFamily="/Nok Air;component/Fonts/Fonts.zip#PSL Display" FontSize="40" HorizontalAlignment="Center" Margin="8,0,0,0"/>
                                        <TextBlock Text="{Binding DepartureTime}" TextWrapping="Wrap" Margin="12,0" Style="{StaticResource PhoneTextSubtleStyle}" Foreground="Black" FontFamily="/Nok Air;component/Fonts/Fonts.zip#PSL Display" FontSize="40" HorizontalAlignment="Center" VerticalAlignment="Center"/>
                                        <TextBlock Text="Arr." Style="{StaticResource PhoneTextExtraLargeStyle}" Foreground="Black" FontFamily="/Nok Air;component/Fonts/Fonts.zip#PSL Display" FontSize="40" HorizontalAlignment="Center" Margin="8,0,0,0"/>
                                        <TextBlock Text="{Binding ArrivalTime}" TextWrapping="Wrap" Style="{StaticResource PhoneTextExtraLargeStyle}" Foreground="Black" FontFamily="/Nok Air;component/Fonts/Fonts.zip#PSL Display" FontSize="40" HorizontalAlignment="Center" VerticalAlignment="Center"/>
                                    </StackPanel>
                                    <Grid>
                                        <Grid.ColumnDefinitions>
                                            <ColumnDefinition/>
                                            <ColumnDefinition/>
                                            <ColumnDefinition/>
                                        </Grid.ColumnDefinitions>
                                        <Grid Grid.Column="0" DataContext="{Binding ClassEconomy, Converter={StaticResource GroupSellingClassEconomyConverter}}">
                                            <RadioButton GroupName="{Binding GroupRadioBT}" Style="{StaticResource SellingClassRadioButtonStyle}" IsEnabled="{Binding IsEnable}" Checked="ClassEconomy_Checked" Background="#CCFF5C"/>
                                        </Grid>
                                        <Grid Grid.Column="1" DataContext="{Binding ClassFlexi, Converter={StaticResource GroupSellingClassFlexiConverter}}">
                                            <RadioButton GroupName="{Binding GroupRadioBT}" Style="{StaticResource SellingClassRadioButtonStyle}" IsEnabled="{Binding IsEnable}" Checked="ClassFlexi_Checked" Background="#FFC7E1"/>
                                        </Grid>
                                        <Grid Grid.Column="2" DataContext="{Binding ClassNokPlus, Converter={StaticResource GroupSellingClassNokPlusConverter}}">
                                            <RadioButton GroupName="{Binding GroupRadioBT}" Style="{StaticResource SellingClassRadioButtonStyle}" IsEnabled="{Binding IsEnable}" Checked="ClassNokPlus_Checked" Background="#A3FFF5"/>
                                        </Grid>
                                    </Grid>
                                </StackPanel>
                            </Grid>
                        </DataTemplate>
                    </ListBox.ItemTemplate>
                </ListBox>
            </StackPanel>
        </DataTemplate>
        <Storyboard x:Name="showSummary">
            <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="grid">
                <EasingDoubleKeyFrame KeyTime="0" Value="0"/>
                <EasingDoubleKeyFrame KeyTime="0:0:0.3" Value="1"/>
            </DoubleAnimationUsingKeyFrames>
            <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Height)" Storyboard.TargetName="PivotPricesList">
                <EasingDoubleKeyFrame KeyTime="0:0:0.3" Value="570"/>
            </DoubleAnimationUsingKeyFrames>
        </Storyboard>
	</phone:PhoneApplicationPage.Resources>

	<Grid x:Name="LayoutRoot">
        <Grid.RowDefinitions>
			<RowDefinition Height="70"/>
			<RowDefinition Height="*"/>
			<RowDefinition Height="80"/>
		</Grid.RowDefinitions>
		<Grid Style="{StaticResource TopAppBarStyle}" Margin="0">
			<Grid.ColumnDefinitions>
    			<ColumnDefinition  Width="1*"/> 		
				<ColumnDefinition  Width="2*"/> 		
				<ColumnDefinition  Width="1*"/> 		
			</Grid.ColumnDefinitions>   
			<Button x:Name="backButton1" Content="Back" HorizontalAlignment="Left"  Width="130" Margin="15,0,0,0" Height="60" Style="{StaticResource BackButtonStyle}" Foreground="White" Visibility="Collapsed" />
			<TextBlock x:Name="Title_checkIn_TextBlock1" Margin="0" TextWrapping="Wrap" Text="Summarize" FontSize="48" TextAlignment="Center" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="White" Grid.Column="1" Visibility="Collapsed"/>
            <Button x:Name="continueButton1" Content="{Binding Continue}" Style="{StaticResource BlueButtonStyle}" Margin="5,0" Click="continueButton_Click" Foreground="White" Grid.Column="2" VerticalAlignment="Center" FontSize="40" />
		</Grid>
		<Grid Style="{StaticResource ContentStyle}" Margin="0">
			<StackPanel>
                <controls:Pivot x:Name="PivotPricesList" ItemsSource="{Binding AvailabilityItems}"
				ItemTemplate="{StaticResource PivotItemTemplate}" VerticalAlignment="Stretch" Height="650">
                	<controls:Pivot.HeaderTemplate>
                		<DataTemplate>
                			<TextBlock x:Name="textBlock" Text="{Binding Converter={StaticResource DepartuerOrReturnSellingClass}}" FontFamily="/Nok Air;component/Fonts/Fonts.zip#PSL Display" FontSize="58" FontWeight="Bold"/>
                		</DataTemplate>
                	</controls:Pivot.HeaderTemplate>
                </controls:Pivot>
                <Grid x:Name="grid" Background="White" MinHeight="80" RenderTransformOrigin="0.5,0.5" Opacity="0" >
				<StackPanel VerticalAlignment="Center" HorizontalAlignment="Center">
					<TextBlock x:Name="summaryDepTBlock" Foreground="#FF1236FF" FontSize="32" HorizontalAlignment="Center"/>
					<TextBlock x:Name="summaryRetTBlock" Foreground="#FF1236FF" FontSize="32" HorizontalAlignment="Center"/>
				</StackPanel>
			</Grid>
			</StackPanel>
		</Grid>
		<Grid Grid.Row="2">
			<local:AppBarMenuUserControl/>
		</Grid>
	</Grid>
</phone:PhoneApplicationPage>